package com.zhaodui.sd.service.impl;
import com.zhaodui.sd.service.SdCarinfoServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.zhaodui.sd.entity.SdCarinfoEntity;
import com.zhaodui.sd.page.SdCarinfoPage;
import com.zhaodui.sd.entity.SdVendorEntity;
import com.zhaodui.sd.entity.SdPoPriceEntity;
import com.zhaodui.sd.entity.SdCarPicEntity;
import com.zhaodui.sd.entity.SdFkLogEntity;
import com.zhaodui.sd.entity.SdCustomerEntity;
import com.zhaodui.sd.entity.SdActivityEntity;
import com.zhaodui.sd.entity.SdPriceEntity;
import com.zhaodui.sd.entity.SdSkLogEntity;
import com.zhaodui.sd.entity.SdCsPlanEntity;
import com.zhaodui.sd.entity.SdCsActityEntity;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import java.util.ArrayList;
import java.util.UUID;
import java.io.Serializable;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.MyClassLoader;
import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
import java.util.Map;
import java.util.HashMap;
import org.jeecgframework.minidao.util.FreemarkerParseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.jeecgframework.core.util.ResourceUtil;

@Service("sdCarinfoService")
@Transactional
public class SdCarinfoServiceImpl extends CommonServiceImpl implements SdCarinfoServiceI {

	@Autowired
	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
 	public void delete(SdCarinfoEntity entity) throws Exception{
 		super.delete(entity);
 	}
	
	public void addMain(SdCarinfoPage sdCarinfoPage) throws Exception {
		SdCarinfoEntity sdCarinfo = new SdCarinfoEntity();
		MyBeanUtils.copyBeanNotNull2Bean(sdCarinfoPage, sdCarinfo);
		//保存主信息
		this.save(sdCarinfo);
		/**保存-供应商*/
		List<SdVendorEntity> sdVendorList = sdCarinfoPage.getSdVendorList();
		for(SdVendorEntity sdVendor:sdVendorList){
			//外键设置
			sdVendor.setCarVin(sdCarinfo.getCarVin());
			this.save(sdVendor);
		}
		/**保存-采购价格明细*/
		List<SdPoPriceEntity> sdPoPriceList = sdCarinfoPage.getSdPoPriceList();
		for(SdPoPriceEntity sdPoPrice:sdPoPriceList){
			//外键设置
			sdPoPrice.setCarVin(sdCarinfo.getCarVin());
			this.save(sdPoPrice);
		}
		/**保存-车辆照片*/
		List<SdCarPicEntity> sdCarPicList = sdCarinfoPage.getSdCarPicList();
		for(SdCarPicEntity sdCarPic:sdCarPicList){
			//外键设置
			sdCarPic.setCarVin(sdCarinfo.getCarVin());
			this.save(sdCarPic);
		}
		/**保存-付款信息*/
		List<SdFkLogEntity> sdFkLogList = sdCarinfoPage.getSdFkLogList();
		for(SdFkLogEntity sdFkLog:sdFkLogList){
			//外键设置
			sdFkLog.setCarVin(sdCarinfo.getCarVin());
			this.save(sdFkLog);
		}
		/**保存-客户*/
		List<SdCustomerEntity> sdCustomerList = sdCarinfoPage.getSdCustomerList();
		for(SdCustomerEntity sdCustomer:sdCustomerList){
			//外键设置
			sdCustomer.setCarVin(sdCarinfo.getCarVin());
			this.save(sdCustomer);
		}
		/**保存-售前活动*/
		List<SdActivityEntity> sdActivityList = sdCarinfoPage.getSdActivityList();
		for(SdActivityEntity sdActivity:sdActivityList){
			//外键设置
			sdActivity.setCarVin(sdCarinfo.getCarVin());
			this.save(sdActivity);
		}
		/**保存-销售价格明细*/
		List<SdPriceEntity> sdPriceList = sdCarinfoPage.getSdPriceList();
		for(SdPriceEntity sdPrice:sdPriceList){
			//外键设置
			sdPrice.setCarVin(sdCarinfo.getCarVin());
			this.save(sdPrice);
		}
		/**保存-收款信息*/
		List<SdSkLogEntity> sdSkLogList = sdCarinfoPage.getSdSkLogList();
		for(SdSkLogEntity sdSkLog:sdSkLogList){
			//外键设置
			sdSkLog.setCarVin(sdCarinfo.getCarVin());
			this.save(sdSkLog);
		}
		/**保存-售后计划*/
		List<SdCsPlanEntity> sdCsPlanList = sdCarinfoPage.getSdCsPlanList();
		for(SdCsPlanEntity sdCsPlan:sdCsPlanList){
			//外键设置
			sdCsPlan.setCarVin(sdCarinfo.getCarVin());
			this.save(sdCsPlan);
		}
		/**保存-售后活动*/
		List<SdCsActityEntity> sdCsActityList = sdCarinfoPage.getSdCsActityList();
		for(SdCsActityEntity sdCsActity:sdCsActityList){
			//外键设置
			sdCsActity.setCarVin(sdCarinfo.getCarVin());
			this.save(sdCsActity);
		}
	}

	
	public void updateMain(SdCarinfoPage sdCarinfoPage) throws Exception{
		SdCarinfoEntity sdCarinfo = new SdCarinfoEntity();
		//保存主表信息
		if(StringUtil.isNotEmpty(sdCarinfoPage.getId())){
			sdCarinfo = findUniqueByProperty(SdCarinfoEntity.class, "id", sdCarinfoPage.getId());
			MyBeanUtils.copyBeanNotNull2Bean(sdCarinfoPage, sdCarinfo);
			this.saveOrUpdate(sdCarinfo);
		}else{
			this.saveOrUpdate(sdCarinfo);
		}
		//===================================================================================
		//获取参数
		Object carVin0 = sdCarinfo.getCarVin();
		Object carVin1 = sdCarinfo.getCarVin();
		Object carVin2 = sdCarinfo.getCarVin();
		Object carVin3 = sdCarinfo.getCarVin();
		Object carVin4 = sdCarinfo.getCarVin();
		Object carVin5 = sdCarinfo.getCarVin();
		Object carVin6 = sdCarinfo.getCarVin();
		Object carVin7 = sdCarinfo.getCarVin();
		Object carVin8 = sdCarinfo.getCarVin();
		Object carVin9 = sdCarinfo.getCarVin();
		//===================================================================================
		//1.供应商数据库的数据
	    String hql0 = "from SdVendorEntity where 1 = 1 AND carVin = ? ";
	    List<SdVendorEntity> sdVendorOldList = this.findHql(hql0,carVin0);
		//2.供应商新的数据
		List<SdVendorEntity> sdVendorList = sdCarinfoPage.getSdVendorList();
	    //3.筛选更新明细数据-供应商
		if(sdVendorList!=null &&sdVendorList.size()>0){
			for(SdVendorEntity oldE:sdVendorOldList){
				boolean isUpdate = false;
				for(SdVendorEntity sendE:sdVendorList){
					//需要更新的明细数据-供应商
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-供应商
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-供应商
			for(SdVendorEntity sdVendor:sdVendorList){
				if(oConvertUtils.isEmpty(sdVendor.getId())){
					//外键设置
					sdVendor.setCarVin(sdCarinfo.getCarVin());
					this.save(sdVendor);
				}
			}
		}
		//===================================================================================
		//1.采购价格明细数据库的数据
	    String hql1 = "from SdPoPriceEntity where 1 = 1 AND carVin = ? ";
	    List<SdPoPriceEntity> sdPoPriceOldList = this.findHql(hql1,carVin1);
		//2.采购价格明细新的数据
		List<SdPoPriceEntity> sdPoPriceList = sdCarinfoPage.getSdPoPriceList();
	    //3.筛选更新明细数据-采购价格明细
		if(sdPoPriceList!=null &&sdPoPriceList.size()>0){
			for(SdPoPriceEntity oldE:sdPoPriceOldList){
				boolean isUpdate = false;
				for(SdPoPriceEntity sendE:sdPoPriceList){
					//需要更新的明细数据-采购价格明细
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-采购价格明细
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-采购价格明细
			for(SdPoPriceEntity sdPoPrice:sdPoPriceList){
				if(oConvertUtils.isEmpty(sdPoPrice.getId())){
					//外键设置
					sdPoPrice.setCarVin(sdCarinfo.getCarVin());
					this.save(sdPoPrice);
				}
			}
		}
		//===================================================================================
		//1.车辆照片数据库的数据
	    String hql2 = "from SdCarPicEntity where 1 = 1 AND carVin = ? ";
	    List<SdCarPicEntity> sdCarPicOldList = this.findHql(hql2,carVin2);
		//2.车辆照片新的数据
		List<SdCarPicEntity> sdCarPicList = sdCarinfoPage.getSdCarPicList();
	    //3.筛选更新明细数据-车辆照片
		if(sdCarPicList!=null &&sdCarPicList.size()>0){
			for(SdCarPicEntity oldE:sdCarPicOldList){
				boolean isUpdate = false;
				for(SdCarPicEntity sendE:sdCarPicList){
					//需要更新的明细数据-车辆照片
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-车辆照片
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-车辆照片
			for(SdCarPicEntity sdCarPic:sdCarPicList){
				if(oConvertUtils.isEmpty(sdCarPic.getId())){
					//外键设置
					sdCarPic.setCarVin(sdCarinfo.getCarVin());
					this.save(sdCarPic);
				}
			}
		}
		//===================================================================================
		//1.付款信息数据库的数据
	    String hql3 = "from SdFkLogEntity where 1 = 1 AND carVin = ? ";
	    List<SdFkLogEntity> sdFkLogOldList = this.findHql(hql3,carVin3);
		//2.付款信息新的数据
		List<SdFkLogEntity> sdFkLogList = sdCarinfoPage.getSdFkLogList();
	    //3.筛选更新明细数据-付款信息
		if(sdFkLogList!=null &&sdFkLogList.size()>0){
			for(SdFkLogEntity oldE:sdFkLogOldList){
				boolean isUpdate = false;
				for(SdFkLogEntity sendE:sdFkLogList){
					//需要更新的明细数据-付款信息
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-付款信息
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-付款信息
			for(SdFkLogEntity sdFkLog:sdFkLogList){
				if(oConvertUtils.isEmpty(sdFkLog.getId())){
					//外键设置
					sdFkLog.setCarVin(sdCarinfo.getCarVin());
					this.save(sdFkLog);
				}
			}
		}
		//===================================================================================
		//1.客户数据库的数据
	    String hql4 = "from SdCustomerEntity where 1 = 1 AND carVin = ? ";
	    List<SdCustomerEntity> sdCustomerOldList = this.findHql(hql4,carVin4);
		//2.客户新的数据
		List<SdCustomerEntity> sdCustomerList = sdCarinfoPage.getSdCustomerList();
	    //3.筛选更新明细数据-客户
		if(sdCustomerList!=null &&sdCustomerList.size()>0){
			for(SdCustomerEntity oldE:sdCustomerOldList){
				boolean isUpdate = false;
				for(SdCustomerEntity sendE:sdCustomerList){
					//需要更新的明细数据-客户
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-客户
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-客户
			for(SdCustomerEntity sdCustomer:sdCustomerList){
				if(oConvertUtils.isEmpty(sdCustomer.getId())){
					//外键设置
					sdCustomer.setCarVin(sdCarinfo.getCarVin());
					this.save(sdCustomer);
				}
			}
		}
		//===================================================================================
		//1.售前活动数据库的数据
	    String hql5 = "from SdActivityEntity where 1 = 1 AND carVin = ? ";
	    List<SdActivityEntity> sdActivityOldList = this.findHql(hql5,carVin5);
		//2.售前活动新的数据
		List<SdActivityEntity> sdActivityList = sdCarinfoPage.getSdActivityList();
	    //3.筛选更新明细数据-售前活动
		if(sdActivityList!=null &&sdActivityList.size()>0){
			for(SdActivityEntity oldE:sdActivityOldList){
				boolean isUpdate = false;
				for(SdActivityEntity sendE:sdActivityList){
					//需要更新的明细数据-售前活动
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-售前活动
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-售前活动
			for(SdActivityEntity sdActivity:sdActivityList){
				if(oConvertUtils.isEmpty(sdActivity.getId())){
					//外键设置
					sdActivity.setCarVin(sdCarinfo.getCarVin());
					this.save(sdActivity);
				}
			}
		}
		//===================================================================================
		//1.销售价格明细数据库的数据
	    String hql6 = "from SdPriceEntity where 1 = 1 AND carVin = ? ";
	    List<SdPriceEntity> sdPriceOldList = this.findHql(hql6,carVin6);
		//2.销售价格明细新的数据
		List<SdPriceEntity> sdPriceList = sdCarinfoPage.getSdPriceList();
	    //3.筛选更新明细数据-销售价格明细
		if(sdPriceList!=null &&sdPriceList.size()>0){
			for(SdPriceEntity oldE:sdPriceOldList){
				boolean isUpdate = false;
				for(SdPriceEntity sendE:sdPriceList){
					//需要更新的明细数据-销售价格明细
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-销售价格明细
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-销售价格明细
			for(SdPriceEntity sdPrice:sdPriceList){
				if(oConvertUtils.isEmpty(sdPrice.getId())){
					//外键设置
					sdPrice.setCarVin(sdCarinfo.getCarVin());
					this.save(sdPrice);
				}
			}
		}
		//===================================================================================
		//1.收款信息数据库的数据
	    String hql7 = "from SdSkLogEntity where 1 = 1 AND carVin = ? ";
	    List<SdSkLogEntity> sdSkLogOldList = this.findHql(hql7,carVin7);
		//2.收款信息新的数据
		List<SdSkLogEntity> sdSkLogList = sdCarinfoPage.getSdSkLogList();
	    //3.筛选更新明细数据-收款信息
		if(sdSkLogList!=null &&sdSkLogList.size()>0){
			for(SdSkLogEntity oldE:sdSkLogOldList){
				boolean isUpdate = false;
				for(SdSkLogEntity sendE:sdSkLogList){
					//需要更新的明细数据-收款信息
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-收款信息
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-收款信息
			for(SdSkLogEntity sdSkLog:sdSkLogList){
				if(oConvertUtils.isEmpty(sdSkLog.getId())){
					//外键设置
					sdSkLog.setCarVin(sdCarinfo.getCarVin());
					this.save(sdSkLog);
				}
			}
		}
		//===================================================================================
		//1.售后计划数据库的数据
	    String hql8 = "from SdCsPlanEntity where 1 = 1 AND carVin = ? ";
	    List<SdCsPlanEntity> sdCsPlanOldList = this.findHql(hql8,carVin8);
		//2.售后计划新的数据
		List<SdCsPlanEntity> sdCsPlanList = sdCarinfoPage.getSdCsPlanList();
	    //3.筛选更新明细数据-售后计划
		if(sdCsPlanList!=null &&sdCsPlanList.size()>0){
			for(SdCsPlanEntity oldE:sdCsPlanOldList){
				boolean isUpdate = false;
				for(SdCsPlanEntity sendE:sdCsPlanList){
					//需要更新的明细数据-售后计划
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-售后计划
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-售后计划
			for(SdCsPlanEntity sdCsPlan:sdCsPlanList){
				if(oConvertUtils.isEmpty(sdCsPlan.getId())){
					//外键设置
					sdCsPlan.setCarVin(sdCarinfo.getCarVin());
					this.save(sdCsPlan);
				}
			}
		}
		//===================================================================================
		//1.售后活动数据库的数据
	    String hql9 = "from SdCsActityEntity where 1 = 1 AND carVin = ? ";
	    List<SdCsActityEntity> sdCsActityOldList = this.findHql(hql9,carVin9);
		//2.售后活动新的数据
		List<SdCsActityEntity> sdCsActityList = sdCarinfoPage.getSdCsActityList();
	    //3.筛选更新明细数据-售后活动
		if(sdCsActityList!=null &&sdCsActityList.size()>0){
			for(SdCsActityEntity oldE:sdCsActityOldList){
				boolean isUpdate = false;
				for(SdCsActityEntity sendE:sdCsActityList){
					//需要更新的明细数据-售后活动
					if(oldE.getId().equals(sendE.getId())){
		    			try {
							MyBeanUtils.copyBeanNotNull2Bean(sendE,oldE);
							this.saveOrUpdate(oldE);
						} catch (Exception e) {
							e.printStackTrace();
							throw new BusinessException(e.getMessage());
						}
						isUpdate= true;
		    			break;
		    		}
		    	}
	    		if(!isUpdate){
		    		//如果数据库存在的明细，前台没有传递过来则是删除-售后活动
		    		super.delete(oldE);
	    		}
	    		
			}
			//4.持久化新增的数据-售后活动
			for(SdCsActityEntity sdCsActity:sdCsActityList){
				if(oConvertUtils.isEmpty(sdCsActity.getId())){
					//外键设置
					sdCsActity.setCarVin(sdCarinfo.getCarVin());
					this.save(sdCsActity);
				}
			}
		}
	}

	
	public void delMain(SdCarinfoEntity sdCarinfo) throws Exception{
		//删除主表信息
		this.delete(sdCarinfo);
		//===================================================================================
		//获取参数
		Object carVin0 = sdCarinfo.getCarVin();
		Object carVin1 = sdCarinfo.getCarVin();
		Object carVin2 = sdCarinfo.getCarVin();
		Object carVin3 = sdCarinfo.getCarVin();
		Object carVin4 = sdCarinfo.getCarVin();
		Object carVin5 = sdCarinfo.getCarVin();
		Object carVin6 = sdCarinfo.getCarVin();
		Object carVin7 = sdCarinfo.getCarVin();
		Object carVin8 = sdCarinfo.getCarVin();
		Object carVin9 = sdCarinfo.getCarVin();
		//===================================================================================
		//删除-供应商
	    String hql0 = "from SdVendorEntity where 1 = 1 AND carVin = ? ";
	    List<SdVendorEntity> sdVendorOldList = this.findHql(hql0,carVin0);
		this.deleteAllEntitie(sdVendorOldList);
		//===================================================================================
		//删除-采购价格明细
	    String hql1 = "from SdPoPriceEntity where 1 = 1 AND carVin = ? ";
	    List<SdPoPriceEntity> sdPoPriceOldList = this.findHql(hql1,carVin1);
		this.deleteAllEntitie(sdPoPriceOldList);
		//===================================================================================
		//删除-车辆照片
	    String hql2 = "from SdCarPicEntity where 1 = 1 AND carVin = ? ";
	    List<SdCarPicEntity> sdCarPicOldList = this.findHql(hql2,carVin2);
		this.deleteAllEntitie(sdCarPicOldList);
		//===================================================================================
		//删除-付款信息
	    String hql3 = "from SdFkLogEntity where 1 = 1 AND carVin = ? ";
	    List<SdFkLogEntity> sdFkLogOldList = this.findHql(hql3,carVin3);
		this.deleteAllEntitie(sdFkLogOldList);
		//===================================================================================
		//删除-客户
	    String hql4 = "from SdCustomerEntity where 1 = 1 AND carVin = ? ";
	    List<SdCustomerEntity> sdCustomerOldList = this.findHql(hql4,carVin4);
		this.deleteAllEntitie(sdCustomerOldList);
		//===================================================================================
		//删除-售前活动
	    String hql5 = "from SdActivityEntity where 1 = 1 AND carVin = ? ";
	    List<SdActivityEntity> sdActivityOldList = this.findHql(hql5,carVin5);
		this.deleteAllEntitie(sdActivityOldList);
		//===================================================================================
		//删除-销售价格明细
	    String hql6 = "from SdPriceEntity where 1 = 1 AND carVin = ? ";
	    List<SdPriceEntity> sdPriceOldList = this.findHql(hql6,carVin6);
		this.deleteAllEntitie(sdPriceOldList);
		//===================================================================================
		//删除-收款信息
	    String hql7 = "from SdSkLogEntity where 1 = 1 AND carVin = ? ";
	    List<SdSkLogEntity> sdSkLogOldList = this.findHql(hql7,carVin7);
		this.deleteAllEntitie(sdSkLogOldList);
		//===================================================================================
		//删除-售后计划
	    String hql8 = "from SdCsPlanEntity where 1 = 1 AND carVin = ? ";
	    List<SdCsPlanEntity> sdCsPlanOldList = this.findHql(hql8,carVin8);
		this.deleteAllEntitie(sdCsPlanOldList);
		//===================================================================================
		//删除-售后活动
	    String hql9 = "from SdCsActityEntity where 1 = 1 AND carVin = ? ";
	    List<SdCsActityEntity> sdCsActityOldList = this.findHql(hql9,carVin9);
		this.deleteAllEntitie(sdCsActityOldList);
	}
	
 	
}